package com.company.Shangji;

public class Ceshi {
    public static void main(String[] args) {
//        Thread thread1=new Xiancheng1();
//
//
//        Thread thread2=new Xiancheng2();
//
//        thread1.start();
//        thread2.start();
        Thread t=new Mythread();
        t.setName("普通苹果");
        Thread t2=new MyThread2();
        t2.setName("黄金苹果");
        try {
            for (int i = 1; i < 8; i++) {
                t.sleep(1000);
                System.out.println(t.getName()+":第"+i+"箱");
                if (i==5){
                    t2.join();
                }
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
